#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;
const int N = 5e5 + 10;

int n, q;
char str[N * 2];

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> q >> str;
    for(int i = 0; i < n; i ++) str[i + n] = str[i];
    
    int head = 0, tail = n - 1;
    int op, x;
    while(q --){
        cin >> op >> x;
        if(op == 1){
            head = (tail - x + 1) % n;
            tail = head + n - 1;
        }else{
            cout << str[head + x - 1] << '\n';
        }
    }


    return 0;
}